home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / C-D / DartmouthXCMDs.cpt / Dartmouth XCMDs Vol 1&2 / card_4966.txt < prev    next >
Text File  |  1989-02-26  |  4KB  |  108 lines

  1. -- card: 4966 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 3241
  5. -- name: TextStream
  6.  
  7.  
  8. -- part 1 (button)
  9. -- low flags: 00
  10. -- high flags: A003
  11. -- rect: left=57 top=300 right=322 bottom=214
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 1
  15. -- font id: 0
  16. -- text size: 12
  17. -- style flags: 0
  18. -- line height: 16
  19. -- part name: TextStream Example
  20. ----- HyperTalk script -----
  21. on mouseUp
  22.   textstream "field 1",8,10,4,4
  23. end mouseUp
  24.  
  25.  
  26.  
  27. -- part 3 (button)
  28. -- low flags: 00
  29. -- high flags: A003
  30. -- rect: left=314 top=300 right=322 bottom=435
  31. -- title width / last selected line: 0
  32. -- icon id / first selected line: 0 / 0
  33. -- text alignment: 1
  34. -- font id: 0
  35. -- text size: 12
  36. -- style flags: 0
  37. -- line height: 16
  38. -- part name: Print All Docs
  39. ----- HyperTalk script -----
  40. on mouseUp
  41.   set lockscreen to true
  42.   push card
  43.   put the number of cards of bkgnd 2 into count
  44.   put empty into toPrint
  45.   repeat with i = 1 to count
  46.     go to card i of bkgnd 2
  47.     put the number of this card into thisCard
  48.     put "bkgnd field 1 of card" && thisCard & "," after toPrint
  49.   end repeat
  50.   delete last char of toPrint
  51.   pop card
  52.   textstream toPrint,8,10,5,4
  53.   set lockscreen to false
  54. end mouseUp
  55.  
  56.  
  57. -- part contents for background part 16
  58. ----- text -----
  59. TEXTSTREAM XCMD version 1.2
  60. Kevin Calhoun
  61.  
  62. ABOUT TEXTSTREAM
  63. The TextStream XCMD allows you to print the contents of a container using your printer's built-in font.  You can print the contents of just one container at a time or of several at once.  You have the option of telling TextStream how many characters wide you want your left and right margins to be and how many lines tall you want your top and bottom margins to be.
  64.  
  65. In case of an error, TextStream returns an error message as the Result.  Word 1 of this message will be "Error."   
  66.  
  67. TextStream works with both the LaserWriter and the ImageWriter.
  68.  
  69. INVOKING TEXTSTREAM:
  70. TextStream "containerList",<leftMargin>,<rightMargin>,<topMargin>,<bottomMargin>
  71.  
  72. Parameters given inside the brackets, such as  <notNeeded>,  are optional.
  73.  
  74. The containerList is a list of containers to be printed, and may include fields.  Anything you can "get" and "put" you can print, such as "background field 3 of card 2" or even "the userlevel." 
  75.  
  76. If you don't include the optional information for margins (or if you give unreasonable numbers for margins), TextStream will default to 96 chars per line and 63 lines per page, which is as much as either the LaserWriter or the ImageWriter can fit on a page, and which produces somewhat crowded-looking copy.
  77.  
  78. SETTING MARGINS
  79. The parameters leftMargin and rightMargin are the numbers of characters to skip at the start and the end of each line.  The parameters topMargin and bottomMargin are the numbers of lines to skip at the top and the bottom of each page.  A leftMargin of 8, a rightMargin of 10, a topMargin of 4, and a bottomMargin of 4 will produce clean-looking copy.  
  80.  
  81. Valid examples--
  82. TextStream "bkgnd field 1",8,10            --only left and right margins specified
  83. TextStream "containerFoo","","",5,5    --only top and bottom margins specified
  84. TextStream "card field Philately"            --no margin settings
  85. TextStream "card field id 4 of card 2, card field id 3 of card 5, bkgnd field 1"   --multiple
  86.       --containers
  87. TextStream "field 1",8,10,4,4               --these are the settings I prefer for the margins
  88.  
  89. See the script of the button below for an example.
  90.  
  91. It is possible to put the designation of containers to print into a variable and then pass the variable to TextStream, as follows‚Ķ
  92.  
  93. on openField
  94.   if the optionKey is down then
  95.     put the name of the target into theName
  96.     put the id of the target into theField
  97.     if word 1 of theName is "card" then
  98.       put "card field id " before theField
  99.     else put "field id " before theField
  100.     TextStream theField,8,10,5,5
  101.   end if
  102. end openField
  103.  
  104. This handler prints a field using TextStream if the field is clicked while the option key is down.
  105.  
  106. CHANGE HISTORY
  107. 7 March 1988 -- 1.0
  108. 7 April 1988 -- 1.2  Prints any container, not just fields.